﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Wpf.CommonTools.StaticExtension;

namespace Convertor.Interface
{
    /// <summary>
    /// 输出内容接口
    /// </summary>
    public interface IConvertParamters
    {
        /// <summary>
        /// Last input content(To save input content)
        /// </summary>
        object LastInputContent { get; set; }
        /// <summary>
        /// Converted content
        /// </summary>
        object OutputContent { get; set; }
        /// <summary>
        /// Set or get convert stop or continue
        /// </summary>
        bool StopConvert { get; set; }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        IConvertParamters Copy();
    }


    /// <summary>
    /// 
    /// </summary>
    public class ConvertParamters : IConvertParamters
    {
        /// <summary>
        /// 
        /// </summary>
        public object LastInputContent { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public object OutputContent { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public bool StopConvert { get; set; }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="lastInputContent"></param>
        public ConvertParamters(object lastInputContent)
        {
            LastInputContent = lastInputContent;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="lastInputContent"></param>
        /// <param name="output"></param>
        public ConvertParamters(object lastInputContent, object output)
            : this(lastInputContent)
        {
            OutputContent = output;
        }
        public ConvertParamters()
        {
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return (LastInputContent ?? string.Empty).ToString();
        }

        public IConvertParamters Copy()
        {
            return new ConvertParamters(this.LastInputContent, this.OutputContent) { };
        }

    }
}
